// Copyright 2021 Guoyoko. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "Slate/SSWPropertyRowBaseWidget.h"


/**
 * Vector Slate control
 */
class SSWPropertyVectorWidget : public SSWPropertyRowBaseWidget
{

public:
	SLATE_BEGIN_ARGS(SSWPropertyVectorWidget) {}
	
	SLATE_ARGUMENT(FName, NodeName)

	SLATE_END_ARGS()

	void Construct(const FArguments& InArgs, class FSWBaseProperty* InBaseProperty);

private:

	TOptional<float> GetLocationX() const;
	TOptional<float> GetLocationY() const;
	TOptional<float> GetLocationZ() const;
	void OnSetTransformAxis(float NewValue, ETextCommit::Type CommitInfo, EAxisList::Type Axis, bool bCommitted);

	/**
	 * Construct widgets for the X Value
	 */
	void ConstructX(const FArguments& InArgs, TSharedRef<SHorizontalBox> HorizontalBox);

	/**
	 * Construct widgets for the Y Value
	 */
	void ConstructY(const FArguments& InArgs, TSharedRef<SHorizontalBox> HorizontalBox);

	/**
	 * Construct widgets for the Z Value
	 */
	void ConstructZ(const FArguments& InArgs, TSharedRef<SHorizontalBox> HorizontalBox);
};

